<?php
namespace app\serverintegralmall\service\goods;
use \app\manage\service\ApiBase;
/**
 * @author:      李颖
 * @DateTime:    2017-10-27 17:46:42
 * @Description: 积分商城 - 商品分类
 */
class GoodsCategory extends ApiBase{
	

	protected $goodsCategoryLogic = '\app\serverintegralmall\logic\GoodsCategory';
    protected $goodsCategoryValidate = '\app\serverintegralmall\validate\GoodsCategory';

    use \app\serveruser\traits\AddAppIdToRunOne;

	//添加商品分类
    public function addGoodsCate()
    {
        $data = $this->haveIssetReceiveData(['app_id'=>'','other_app_read'=>'','is_public'=>' ','name'=>' ', 'pid'=>' ','profile_pic'=>'','keywords'=>'','description'=>'','order'=>100, 'token'=>' '],[]);
        return $this->oneStepRun($data, 'serverintegralmall/goods/GoodsCategory/addGoodsCate', '', '1', $this->goodsCategoryValidate, $this->goodsCategoryLogic);
    }
    //编辑商品分类
    public function editGoodsCate()
    {
        $data = $this->issetReceiveData(['other_app_read'=>'','is_public'=>' ','name'=>' ','id'=>' ','profile_pic'=>'','keywords'=>'','description'=>'','order'=>100, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/GoodsCategory/editGoodsCate', $this->goodsCategoryValidate, $this->goodsCategoryLogic);
    }
    //后台获取某商品分类的详细信息
    public function oneCateInfo(): array
    {
        $data = $this->issetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/GoodsCategory/oneCateInfo', $this->goodsCategoryValidate, $this->goodsCategoryLogic);
    }
    /*
        根据id数组 启用/禁用一个或多个分类
        父类被禁用，则其所有子类也被禁用，开启同理
    */
    public function changeCateStatus(): array
    {
        $data = $this->issetReceiveData(['id'=>0,'status'=>' ', 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/GoodsCategory/changeCateStatus', $this->goodsCategoryValidate, $this->goodsCategoryLogic);
    }
    //获取商品分类列表
    public function goodsCateList(): array
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/GoodsCategory/goodsCateList', $this->goodsCategoryValidate, $this->goodsCategoryLogic);
    }
    //删除一个或多个商品分类
    public function delCate(): array
    {
        $data = $this->issetReceiveData(['id'=>[], 'token'=>' ']);
        return $this->_addAppIdToRunOne($data, 'serverintegralmall/goods/GoodsCategory/delCate', $this->goodsCategoryValidate, $this->goodsCategoryLogic);
    }










}